<?php
    session_start();
	if(!isset($_SESSION['loggedinuser'])){
		header("location:index.php");
	}
    require_once "../../config/tanggal.php";
    require_once "../../app/dao/database.php";
    
    $class_db = new Database;
	
	include_once("../../app/dao/login.php");
	$log = new Login_Dao($class_db);
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Main Menu</title>
<link type="text/css" rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/paging.css" />

<!-- Bootstrap 
<link type="text/css" rel="stylesheet" href="css/bootstrap.min.css">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<script src="js/bootstrap.js"></script>
<script src="js/bootstrap.min.js"></script>
Bootstrap -->

<link rel="stylesheet" href="css/animated.css"/>
	
	<script src="js/jquery.js" type="text/javascript"></script>
	<script src="js/jquery.easing.1.3.js" type="text/javascript"></script>
	<script src="js/animated.js" type="text/javascript"></script>
    
</head>
<body>

<?php
    $query = "SELECT category, user_id FROM user WHERE username='".$log->getUserName()."'";
    
    $cat_user = $class_db->select_table($query);
    
    foreach($cat_user as $data){
        $cat = $data['category'];
        $id = $data['user_id'];
    }
    
?>
    <div class="container">
	<div class="row">
	<div class="navbar">
	<div class="navbar-inner">
	<ul>
<?php
    if($cat=='1'){
?>
	<li class="green"><p><a href="index.php">Home</p></a>
    <p class="subtext">Beranda</p>
    </li>
    <li class="yellow"><p><a href="user_view.php">User</p></a>
    <p class="subtext">Pengelolaan User</p></li>	
    <li class="blue"><p><a href="store_view.php">Toko</p></a>
    <p class="subtext">Pengelolaan Toko</p></li>
    <li class="red"><p><a href="product_view.php">Produk</p></a>
    <p class="subtext">Pengelolaan Produk</p></li>
	<li class="red"><p><a href="message_view.php">Pesan</p></a>
    <p class="subtext">Pesan Masuk</p></li>

<?php
    }elseif($cat=='3'){
        $q = "SELECT store_id FROM store WHERE user_id=".$id;
        $r = $class_db->select_table($q);
    
        foreach($r as $data){            
            $_SESSION['id_toko'] = $data['store_id'];
        }
        
        //print_r($_SESSION[id_toko]);
?>
    <li class="green"><p><a href="index.php">Home</p></a>
    <p class="subtext">Beranda</p>
    </li>
	<li class="blue"><p><a href="blog_view.php">Blog</p></a>
    <p class="subtext">Pengelolaan Blog</p></li>
	<li class="purple"><p><a href="order_view.php">Order</p></a>
    <p class="subtext">Pengelolaan Order</p></li>
    <li class="red"><p><a href="test_report.php">Laporan</p></a>
    <p class="subtext">Cetak Laporan Penjualan</p></li>
    <li class="yellow"><p><a href="statistik.php">Statistik</p></a>
    <p class="subtext">Dashboard Statistik</p></li>
<?php } ?>
	</ul>
    
	<ul class="nav pull-right">
	<li class="green"><p><?php echo $log->getUserName();?></p>
        <p class="subtext">Nama User</p></li>
	<li class="red"><p><a href="logout_aksi.php">Log out</p></a>
        <p class="subtext">Keluar dari Sistem</p></li>
	</ul>
	</div>
	</div>
    <?php //print_r($cat_user); ?>
	</div>
	</div>
